const _ = require('lodash')

const reverse = array => array.reverse();
const first = array => array[0];
const toUpper = s => s.toUpperCase();


// function compose(...args) {
//     return function(value) {
//         return args.reverse().reduce((acc, fn) => {
//             return fn(acc);
//         }, value)
//     }
// }
const compose = (...args) =>  value => args.reverse().reduce((acc, fn) => fn(acc), value);

// const f = _.flowRight(toUpper, first, reverse);
const f = _.flowRight(_.toUpper, _.first, _.reverse);
// const f = compose(toUpper, first, reverse);

console.log(f(['a', 'b', 'c']))